function MathHandle(x, y) {
  this.x = x;
  this.y = y;
}

MathHandle.prototype.add = function() {
  return this.x + this.y
}
const ad = new MathHandle(1,3)
// console.log(ad.add())

// es6 继承

class Animal {
  constructor(name) {
    this.name = name
  }

  eat() {
    console.log(this.name + ' 再吃 ')
  }
}

class Dog extends Animal {
  constructor(name) {
    super(name)
    this.name = name
  }

  say() {
    console.log(this.name + ' 在叫')
  }
}

const dog = new Dog('哈士奇')
dog.say()
dog.eat()